package com.fyp.ptma.dao.service;

import java.util.List;

import javax.persistence.PersistenceException;

import org.hibernate.HibernateException;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fyp.ptma.dao.repository.irepository.INotificationDao;
import com.fyp.ptma.dao.service.iservice.INotificationService;
import com.fyp.ptma.model.ApplicationVersion;
import com.fyp.ptma.model.Notification;

@Service
public class NotificationService implements INotificationService {
	@Autowired
	private	INotificationDao notificationDao;

	@Transactional
	public Long save(Object objToSave) throws PersistenceException,
			ConstraintViolationException {
		// TODO Auto-generated method stub
		return notificationDao.save(objToSave);
	}

	@Transactional
	public Long update(Object objToUpdate) throws PersistenceException {
		// TODO Auto-generated method stub
		return notificationDao.update(objToUpdate);
	}

	@Transactional
	public boolean delete(Object objToDelete) throws PersistenceException,
			ConstraintViolationException {
		// TODO Auto-generated method stub
		return notificationDao.delete(objToDelete);
	}

	@Transactional
	public List<Notification> getNotificationsForVersion(
			ApplicationVersion applicationVersion) throws HibernateException {
		// TODO Auto-generated method stub
		return notificationDao.getNotificationsForVersion(applicationVersion);
	}

	@Override
	public void saveOrUpdate(Object objToSave) throws PersistenceException,
			ConstraintViolationException {
		// TODO Auto-generated method stub
		
	}

}
